<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %>

<%@ page import="lwf.factory.WordImageFactory, lwf.factory.PropertyReader, lwf.handler.entities.WordImage, net.lwf.handler.util.ImageHtml, java.util.*"%>

<%

Map mapDirectory = WordImageFactory.getInstance().getWordImage("animal");

		Iterator iterator123 = mapDirectory.entrySet().iterator();
		while(iterator123.hasNext()) {
     		Map.Entry mapentry123 = (Map.Entry) iterator123.next();
		     System.out.println("*******************: " + mapentry123.getKey());
		}
		
		Map mapallwordimages = WordImageFactory.getInstance().getAllWordImages();
		Iterator iterator456 = mapallwordimages.entrySet().iterator();
		while(iterator456.hasNext()) {
     		Map.Entry mapentry456 = (Map.Entry) iterator456.next();
		     System.out.println("~~~~~~~~~~~~~~~~~~~~: " + mapentry456.getKey());
		}

 %>
<body>
 <form>

   
   <table border="1" bordercolor="green">
   <%
   String imageloc = null;
        Map mapdata =   WordImageFactory.getInstance().getImageData();
		Iterator iterator = mapdata.entrySet().iterator();
		while(iterator.hasNext()) {
%>
          <tr>
<%		  
			Map.Entry mapentry = (Map.Entry) iterator.next();
			String directory = (String) mapentry.getKey();
			System.out.println("===> Directory: " + directory);
%>
             <td align="center"><font color="blue"><h2><%=directory%></h2></font></td>
             </tr>
             
             <tr>
             <td>
                <table border="0" bordercolor="blue">
<%			
			
			Map mapsub = (Map) mapentry.getValue();
			Iterator iter1 = mapsub.entrySet().iterator();
			while(iter1.hasNext()) {
%>
                   <tr>
<%			
			
			   Map.Entry mapentry1 = (Map.Entry) iter1.next();
			   String subdir = (String) mapentry1.getKey();
			   System.out.println("......... Word: " + subdir); 
%>
                      <td align="left"><h3><%=subdir%></h3></td>
                      <td>&nbsp;</td>
<%
			   
			   WordImage wi = (WordImage) mapentry1.getValue();
			   if(wi.getWordImages() == null) {
			      wi.print();
			      //String imageloc1 = request.getContextPath() + "/" + wi.getImagePath();
%>
                   <td><img src="<%=wi.getImagePath()%>"></td>
<%			      
			   }
			   else {
			      List wis = wi.getWordImages();
%>
                    <td><table border="1" bordercolor="red"><tr>
<%			      
			      
			      for(int i=0; i<wis.size(); i++) {
			         wi = (WordImage) wis.get(i);
			        //imageloc = request.getContextPath() + "/" + wi.getImagePath();
%>
                     <td><img src="<%=wi.getImagePath()%>"></td>
<%			         
			         wi.print();
			      }
%>
                    </tr></table></td>
<%			      
			   }
			   System.out.println("........................................................");
%>
                  </tr>
<%			   
			}
			System.out.println("  ");
%>
       </table></td> </tr>
<%			
			
		}   
    %>  
    </table>
 </form>
 </body>
